<?php
    include('../config.ini.php');
    include('function.php');
    
    $db = db_connect();
    
    $showcase_id = $_POST['showcase_id'];
    
    $sql = "SELECT * FROM showcase WHERE showcase_id=$showcase_id";
    $result = mysql_query($sql);
    
    $showcase_detail_place = '';
    $showcase_detail_ = '';
    $showcase_gallery = '<div id="showcase_gallery__">';
    
    $row=mysql_fetch_assoc($result);
//    $showcase_gallery .=<<<showcase_img_lits
//		<li><img src="images/showcase/{$showcase_id}/{$row['showcase_img']}" alt="" class="showcase_gallery" /></li>
//showcase_img_lits;
    
    $sql = "SELECT * FROM showcase_img WHERE showcase_id=$showcase_id AND showcase_img_show=1 ORDER BY img_position";
    $result = mysql_query($sql);
    
    $countRow = mysql_num_rows($result);
    
    if($countRow){
	while($row2=mysql_fetch_assoc($result)){
		$showcase_gallery .=<<<showcase_img_lits
		<img src="images/showcase/{$showcase_id}/{$row2['showcase_img_path']}" alt="" class="showcase_gallery" />
showcase_img_lits;
	}
        
        if($countRow==1){
            $class_ctrl=' class="display_none"';
        }else{
            $class_ctrl='';
        }
    }
    
    $showcase_gallery .=<<<showcase_img_lits
            </div>
	    <div id="showcase_gallery_ctrl_prev"{$class_ctrl}>
		<img src="images/header_gallery_ctrl_left.png" alt="Previous" class="showcase_gallery_ctrl" id="showcase_gallery_ctrl_prev_" />
	    </div>
	    <div id="showcase_gallery_ctrl_next"{$class_ctrl}>
		<img src="images/header_gallery_ctrl_right.png" alt="Next" class="showcase_gallery_ctrl" id="showcase_gallery_ctrl_next_" />
	    </div>
showcase_img_lits;
    
    $house_['showcase_detail_place'] = $row['showcase_place'];
    $house_['showcase_detail_'] = $row['showcase_detail'];
    $house_['showcase_gallery'] = $showcase_gallery;
    
    echo json_encode($house_);
    
    db_close($db);
?>